<?php
// +----------------------------------------------------------------------
// | Amicool-MVC [ Dynamic Flexible Agile Devlepment]
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2020 http://amicool.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 郡笑笙 <iamzjs@126.com>
// +---------------------------------------------------------------------- 
 class LoginController extends Controller{ 
    private $model; 
 	function __Construct(){
 		$this->model = new LoginModel;
        parent::__Construct();
 	}
    
     function form(){ 
        $this->display();
     }
     function login(){
        $username = $_POST["username"];
        $pwd = $_POST["pwd"];
       $result = $this->model->checkLogin($username,$pwd);
     	if($result){
            if(!isset($_SESSION)) session_start();
            $_SESSION['user'] = $result;
            //var_dump($_SESSION);exit;
     		redirect('c=user&m=index','登录成功！');
     	}
     	else{
     		redirect('c=login&m=form','用户名或密码不对！');

     	}
     }
}
?>